//
//  MSLoginCell.m
//  MOSS
//
//  Created by apple on 2019/1/9.
//  Copyright © 2019年 apple. All rights reserved.
//

#import "MSRegisterCell.h"

@interface MSRegisterCell ()

@end

@implementation MSRegisterCell

+ (instancetype)createTableView:(UITableView *)tableView {
    MSRegisterCell *cell = [tableView dequeueReusableCellWithIdentifier:@"registerCell"];
    cell.selectionStyle  = UITableViewCellSelectionStyleNone;

    [cell makeViews];
    
    return cell;
}

- (void)makeViews {
    
    
    [self.contentView addSubview:self.textField];
    
    [self.contentView addSubview:self.selectedCountryBtn];
    [self.selectedCountryBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(40);
        make.top.mas_equalTo(25);
        make.height.mas_equalTo(30);
    }];
    
    UIView *shuView = [[UIView alloc]init];
    [self.contentView addSubview:shuView];
    [shuView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.selectedCountryBtn.mas_right).offset(10);
        make.centerY.equalTo(self.selectedCountryBtn);
        make.width.equalTo(0.5);
        make.height.equalTo(18.5);
    }];
    shuView.backgroundColor = tTableViewCellLine;
    shuView.hidden = YES;
    
    [self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
           make.left.mas_equalTo(40);
           make.top.mas_equalTo(25);
           make.width.equalTo(kWindowW-130);
           make.height.mas_equalTo(30);
    }];

    UIView *lineView = [[UIView alloc]init];
    [self.contentView addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(40);
        make.right.equalTo(-40);
        make.top.equalTo(59.5);
        make.height.equalTo(0.5);
    }];
    lineView.backgroundColor = tTableViewCellLine;
}

- (UITextField *)textField {
    if (!_textField) {
        _textField = [[UITextField alloc] init];
        _textField.placeholder = LocalizationKey(@"Please enter your mobile phone number");
//        [_textField setValue:[UIColor colorWithHEX:@"F6F6F6"] forKeyPath:@"_placeholderLabel.textColor"];
        _textField.textColor = tThreeColor;
        _textField.font = [UIFont systemFontOfSize:14];
        _textField.keyboardType = UIKeyboardTypePhonePad;
        _textField.clearButtonMode = UITextFieldViewModeWhileEditing;
    }
    
    return _textField;
}

- (UIButton *)selectedCountryBtn {
    if (!_selectedCountryBtn) {
        _selectedCountryBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        _selectedCountryBtn.tintColor = [UIColor colorWithHEX:maincolor];
//        [_selectedCountryBtn setImage:ImageRenderingName(@"login_down") forState:UIControlStateNormal];
        [_selectedCountryBtn setTitle:@"+86" forState:UIControlStateNormal];
        _selectedCountryBtn.hidden = YES;
    }
    
    return _selectedCountryBtn;
}

@end
